package xiangmu.schoolpaper.controller.bingo.system;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import xiangmu.schoolpaper.pojo.VO.ExtractContentVO;
import xiangmu.schoolpaper.result.Result;
import xiangmu.schoolpaper.service.AdminDataListService;

@RestController
@RequestMapping("/system/extract/content")
@Slf4j
@Tag(name = "管理员端——4数据管理——3抽取管理")
public class SystemExtractContentManagementController {
    @Autowired
    private AdminDataListService adminDataListService;

    /*
        抽取正文内容管理
    */
    @GetMapping("/get-all-content-by-conditions")
    @Operation(summary = "1抽取正文内容管理——获取所有符合筛选条件的抽取的正文数据")
    public Result<IPage<ExtractContentVO>> extractContent(
            @RequestParam(defaultValue = "1") Integer currentPage,
            @RequestParam(defaultValue = "10") Integer pageSize,
            @RequestParam(required = false) Integer facultyId,
            @RequestParam(required = false) Integer graduationYear,
            @RequestParam(required = false) String studentAccount,
            @RequestParam(required = false) String paperTitle
    ){
        log.info("返回所有符合筛选条件的抽取的正文数据");
        IPage<ExtractContentVO> pageData = adminDataListService.extractContent(currentPage, pageSize, facultyId, graduationYear, studentAccount, paperTitle);
        return Result.success(pageData);
    }
}
